<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateComponentTokensTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('component_tokens', function(Blueprint $table)
		{
			$table->increments('id');
			$table->string('appid');
			$table->string('component_verify_ticket')->comment('wechat推送过来的ticket');
			$table->string('component_access_token')->comment('经解密ticket后换回的token');
			$table->dateTime('ticket_updated_at')->default('1970-01-02 00:00:00')->comment('ticket的更新时间, 10分钟更新一次');
			$table->dateTime('token_should_refresh')->default('1970-01-02 00:00:00')->comment('如当前时间超过此值, token当刷新');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('component_tokens');
	}

}
